/*************************************************************************
 *
 * $Id: menu_stfn.h 66 2006-07-30 14:24:48Z alpov $
 * 
 *************************************************************************/         

#ifndef _MENU_STFN_H
#define _MENU_STFN_H

extern unsigned char MenuChangeMain(unsigned char key, unsigned char state);
extern unsigned char MenuChangeValue(unsigned char key, unsigned char state);
extern unsigned char MenuChangeClock(unsigned char key, unsigned char state);

extern unsigned char MenuEditShift(unsigned char key, unsigned char state);
extern unsigned char MenuEditMode(unsigned char key, unsigned char state);
extern unsigned char MenuEditRtc(unsigned char key, unsigned char state);
extern unsigned char MenuEditSwitch(unsigned char key, unsigned char state);
extern unsigned char MenuEditConfig(unsigned char key, unsigned char state);

#define BeginEditing()      { AvrXWaitSemaphore(&DataLock); memcpy(&rwdata_undo, &rwdata, sizeof(RWDATA_STRUCT)); }
#define EndEditing(item)    { AvrXSetSemaphore(&DataLock); Serial_RWDATA_W(item); }
#define CancelEditing()     { memcpy(&rwdata, &rwdata_undo, sizeof(RWDATA_STRUCT)); AvrXSetSemaphore(&DataLock); }

#endif
